<#escape x as (x)!"">
<!DOCTYPE html>
<html>
<head>
<title>${comments}</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="../public/css/bootstrap.min.css">
<link rel="stylesheet" href="../public/css/font-awesome.min.css">
<link rel="stylesheet" href="../public/plugins/jqgrid/ui.jqgrid-bootstrap.css"> 
<link rel="stylesheet" href="../public/plugins/ztree/css/metroStyle/metroStyle.css">
<link rel="stylesheet" href="../public/js/elementui/index.css">
<link rel="stylesheet" href="../public/css/main.css"> 
<script src="../public/libs/jquery.min.js"></script> 
<script src="../public/plugins/layer/layer.js"></script>
<script src="../public/libs/bootstrap.min.js"></script>
<script src="../public/libs/vue.min.js"></script>
<script src="../public/js/elementui/index.js"></script>
<script src="../public/plugins/jqgrid/grid.locale-cn.js"></script>
<script src="../public/plugins/jqgrid/jquery.jqGrid.min.js"></script>
<script src="../public/plugins/ztree/jquery.ztree.all.min.js"></script>
<script src="../public/js/common.js"></script>
</head>
<body>
<div id="rrapp" v-cloak>
	<div v-show="showList">
		<div class="grid-btn">
			<div class="form-group col-sm-2">
				<input type="text" class="form-control" v-model="q.searchName" @keyup.enter="query"
					   placeholder="名称">
			</div>
			<a class="btn btn-default" @click="query">查询</a>
			<a v-if="hasPermission('${pathName}:save')" class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
			<button id="viewbtn" @click="view" style="display: none"> 查看</button>
		</div>

	    <div class="text-left" style="padding: 5px">
            <div style="vertical-align: baseline">
                <div class="col-lg-6  col-md-6 text-left" style="height: 41px;padding-left: 5px;padding-top: 15px;">
                共 <strong>{{total}}</strong> 条数据</div>
                <div class="col-lg-6 col-md-6 text-right" style="padding-bottom: 5px;padding-right: 0px">
                    <el-dropdown size="medium" split-button type="default" @click="exportExl" @command="handleCommand">
                        <i class="fa fa-download"></i> 导出数据
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item command="a">csv</el-dropdown-item>
                            <el-dropdown-item command="b">txt</el-dropdown-item>
                            <el-dropdown-item command="c">Excel</el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </div>
            </div>
            <div style="width: 100%">
                <table id="data" class="table table-bordered table-hover">
                    <thead class="thead-default">
                      <tr>
                        <th class="text-center" style="width: 50px">#</th>
                        <th class="text-center" v-for="ols in columnsList">{{ols.name}}</th>
                        <th class="text-center" style="width: 150px">操作</th>
                      </tr>
                    </thead>
                    <tbody>
                      <tr v-for="(item,index) in dataList">
                        <td class="text-center">{{index+1}}</td>
                        <#if columns??>
                            <#list columns as column>
                                <#if !column.nolist>
                                  <#if column.map??>
                         <td class="text-center" v-if="columnsList[${column_index}].isShow">{{${column.attrname}Map[item
                         .${column.attrname}]}}</td>
                                  <#else>
                         <td class="text-center" v-if="columnsList[${column_index}].isShow">{{item.${column.attrname}}}</td>
                                  </#if>
                                </#if>
                              </#list>
                        </#if>
                        <td class="text-center">
                            <b-button class="btn-sm btn-info "
                                      @click="update(item.${pk.attrname})">
                              <i class="fa fa-edit"></i>修改
                            </b-button>
                            <b-button class="btn-sm btn-danger" @click="delOne(item.${pk.attrname}})">
                              <i class="fa fa-trash-o"></i>删除
                            </b-button>
                        </td>
                      </tr>
                    </tbody>
                </table>
                <div class="text-center" v-show="dataList.length == 0">没有数据</div>
            </div>
	    </div>
    </div>
</div>

    </div>
    <div v-show="!showList">
      <div class="grid-btn">
        <a v-show="!showView" v-if="hasPermission('${pathName}:save')" class="btn btn-primary"
           @click="saveOrUpdate"><i class="fa fa-save"></i>&nbsp;保存</a>
        <a v-show="showView" v-if="hasPermission('${pathName}:update')" class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
        <a v-show="showView" v-if="hasPermission('${pathName}:delete')" class="btn btn-primary" @click="delOne"><i
        class="fa fa-trash-o"></i>&nbsp;删除</a>
        <a  class="btn btn-warning" @click="reload"><i class="fa fa fa-mail-reply"></i>&nbsp;返回</a>
      </div>
    </div>
    <div v-show="!showList" class="panel panel-vue">
		<div class="panel-heading">{{title}}</div>
		<el-form  class="form-horizontal" :model="${classname}" ref="${functionName}Form" :rules="rules">
	<#if columns??>
		<#list columns as column>
                  <#if !column.noinput>
                     <#if column.inputType?? && column.inputType=="select">
                      <el-row class="form-group">
                        <el-col :xs="24" :span="6"  class="control-label">
                          <span>${column.shortComments}:</span>
                        </el-col>
                        <el-col :xs="24" :span="18">
                          <el-form-item prop="${column.attrname}">
                            <el-select v-show="!showView" v-model="${classname}.${column.attrname}" placeholder="请选择">
                              <el-option
                                v-for="item in ${column.attrname}List"
                                :key="item.value"
                                :label="item.text"
                                :value="item.value">
                              </el-option>
                            </el-select>
                            <div v-show="showView">{{${column.attrname}Map[${classname}.${column.attrname}]}}</div>
                          </el-form-item>
                        </el-col>
                      </el-row>
                      <#elseif column.inputType?? && column.inputType=="radio">
                      <el-row class="form-group">
                        <el-col :xs="24" :span="6"  class="control-label">
                          <span>${column.shortComments}:</span>
                        </el-col>
                        <el-col :xs="24" :span="18">
                          <el-form-item prop="${column.attrname}">
                            <el-radio-group v-show="!showView" v-model="${classname}.${column.attrname}">
                              <el-radio v-for="(item,index) in ${column.attrname}List" :label="item.value">{{item.text}}</el-radio>
                            </el-radio-group>
                            <div v-show="showView">{{${column.attrname}Map[${classname}.${column.attrname}]}}</div>
                          </el-form-item>
                        </el-col>
                      </el-row>
                      <#elseif column.inputType?? && column.inputType=="checkbox">
                      <el-row class="form-group">
                        <el-col :xs="24" :span="6"  class="control-label">
                          <span>${column.shortComments}:</span>
                        </el-col>
                        <el-col :xs="24" :span="18">
                          <el-form-item prop="${column.attrname}">
                            <el-checkbox-group v-show="!showView" v-model="${classname}.${column.attrname}">
                              <el-checkbox v-for="(item,index) in ${column.attrname}List" :label="item.value">{{item.text}}</el-checkbox>
                            </el-checkbox-group>
                            <div v-show="showView"> {{${classname}.${column.attrname}}}</div>
                          </el-form-item>
                        </el-col>
                      </el-row>
                      <#elseif column.inputType?? && column.inputType=="textarea">
                        <el-col :xs="24" :span="6"  class="control-label">
                          <span>${column.shortComments}:</span>
                        </el-col>
                        <el-col :xs="24" :span="18">
                          <el-form-item prop="${column.attrname}">
                                <el-input v-show="!showView" type="textarea" :rows="3"
                                v-model="${classname}.${column.attrname}" auto-complete="off"></el-input>
                            <div v-show="showView"> {{${classname}.${column.attrname}}}</div>
                          </el-form-item>
                        </el-col>
                      </el-row>
                      <#elseif column.inputType?? && column.inputType=="date">
                      <el-row class="form-group">
                        <el-col :xs="24" :span="6"  class="control-label">
                          <span>${column.shortComments}:</span>
                        </el-col>
                        <el-col :xs="24" :span="18">
                          <el-form-item prop="${column.attrname}">
                            <el-date-picker v-show="!showView"
                              v-model="${classname}.${column.attrname}"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="选择${column.shortComments}">
                            </el-date-picker>
                            <div v-show="showView"> {{${classname}.${column.attrname}}}</div>
                          </el-form-item>
                        </el-col>
                      </el-row>
                      <#else>
                      <el-row class="form-group">
                        <el-col :xs="24" :span="6"  class="control-label">
                          <span>${column.shortComments}:</span>
                        </el-col>
                        <el-col :xs="24" :span="18">
                          <el-form-item prop="${column.attrname}">
                            <el-input v-show="!showView" v-model="${classname}.${column.attrname}"
                            auto-complete="off"></el-input>
                            <div v-show="showView"> {{${classname}.${column.attrname}}}</div>
                          </el-form-item>

                        </el-col>
                      </el-row>
                      </#if>

                  </#if>
		</#list>
	</#if>
		</el-form>
	</div>
    <div v-show="!showList">
      <div class="grid-btn">
        <a v-show="!showView" v-if="hasPermission('${pathName}:save')" class="btn btn-primary"
           @click="saveOrUpdate"><i class="fa fa-save"></i>&nbsp;保存</a>
        <a v-show="showView" v-if="hasPermission('${pathName}:update')" class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
        <a v-show="showView" v-if="hasPermission('${pathName}:delete')" class="btn btn-primary" @click="delOne"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
        <a  class="btn btn-warning" @click="reload"><i class="fa fa fa-mail-reply"></i>&nbsp;返回</a>
      </div>
    </div>
</div>

<script src="../${modulePackage}/js/${functionName}.js"></script>
</body>
</html>
</#escape>